package com.example.demo.controller;

import com.example.demo.model.UserConfig;
import com.example.demo.web.AjaxResult;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/user")
public class UserController {

	@Autowired
	private UserConfig userConfig;

	@GetMapping("/config")
	public AjaxResult get() throws JsonProcessingException {
		return AjaxResult.success(new ObjectMapper().writeValueAsString(userConfig));
	}

}
